package com.fly.uaa.dao;

import com.fly.common.model.UserEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @description 登录数据映射
 * @author: fly
 * @date: 2018/11/26 14:53
 */
@Repository
public interface LoginMapper {

    /**
     * 根据账户获取用户信息
     *
     * @param userName 账户
     * @return 用户信息
     */
    @Select(value = "select user_id as userId, real_name as realName, user_name as userName, password, mobile, address," +
            " work_num as wordNum from user where is_delete = '0' and user_name = #{userName}")
    UserEntity queryUserByUserName(@Param("userName") String userName);

    /**
     * 根据主键获取用户信息
     *
     * @param userId 主键
     * @return 用户信息
     */
    @Select(value = "select user_id as userId, real_name as realName, user_name as userName, password, mobile, address," +
            " work_num as wordNum from user where is_delete = '0' and user_id = #{userId}")
    UserEntity selectById(@Param("userId") Long userId);
}
